package bug;

import bug.dao.hibernate.ProjectDaoHibernate;
import bug.persistent.Category;
import bug.persistent.Project;
import bug.persistent.User;
import bug.persistent.UserProject;
import org.hibernate.LockMode;

/**
 * User: ion
 * Date: Aug 30, 2008 - 10:54:08 AM
 */

public class Main1 extends BaseMain {

    public static void main(String[] args) {
        new Main1().run();
    }

    public void run() {

        beginSession();
        
        Category c = new Category();
        c.setName("Web Projects.");
        categoryDao.save(c);

        User u1 = new User();
        u1.setFirstName("Ion");
        u1.setLastName("Olaru");
        u1.setEmail("io@olaru.com");
        u1.setLoginName("ion");
        userDao.save(u1);

        User u2 = new User();
        u2.setFirstName("Dina");
        u2.setLastName("Olaru");
        u2.setEmail("io@olaru.com");
        u2.setLoginName("dina");
        userDao.save(u2);

        Project p1 = new Project();
        p1.setName("caAERS");
        projectDao.save(p1);

        Project p2 = new Project();
        p2.setName("C3PR");
        projectDao.save(p2);

        Project p3 = new Project();
        p3.setName("PSC");
        projectDao.save(p3);

        Project p4 = new Project();
        p3.setName("BASA Press web Site");
        projectDao.save(p4);

        UserProject up1 = new UserProject();
        up1.setUser(u1);
        up1.setProject(p1);
        userProjectDao.save(up1);

        UserProject up2 = new UserProject();
        up2.setUser(u1);
        up2.setProject(p2);
        userProjectDao.save(up2);

        UserProject up3 = new UserProject();
        up3.setUser(u1);
        up3.setProject(p3);
        userProjectDao.save(up3);

        UserProject up4 = new UserProject();
        up4.setUser(u2);
        up4.setProject(p1);
        userProjectDao.save(up4);

        endSession();
    }
}
